<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>轮播图点击切换</title>
  <style>
    * {
      box-sizing: border-box;
    }
    .slider{
      width: 540px;
      height: 400px;
      overflow: hidden;
    }
    .slider-wrapper{
      width: 100%;
      height: 320px;
    }
    .slider-wrapper{
      width: 100%;
      height: 100%;
      display: block;
    }

    .slider-footer{
      height: 80px;
      background-color:rgb(100,67,68);
      padding: 12px 12px 0 12px;
      position: relative;
    }

    slider-footer .toggle{
      position: absolute;
      right: 0;
      top: 12px;
      display: flex;
    }

    .slider-footeer .toggle button{
      margin-right: 12px;
      width: 28px;
      height: 28px;
      appearance: none;
      border: none;
      background-color: rgb(255, 255, 255,0.1);
      color: #fff;
      border-radius: 4px;
      cursor: pointer;

    }

    .slider-footeer.toggle button hover{
      background: rgba;
    }
  </style>
</head>
<body>
  <div class="slider">
    <div class="slider-wrappen">
      <img src="/study-js/练习/images/1.webp" alt="">
    </div>
    <div class="slider-footer">
      <ul class="slider-indicator"></ul>
      <li class="active"></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </div>
  <div class=" toggle">
    <button class="prev">&lt;</button>
    <button class="next">&lt;</button>
  </div>
  </div>
  <script>
    //1.初始化数据
    const sliderData = [
      { url: '../../../../images/webapi/第一单元/slider01.jpg', title: '对人类来说会不会太超前了？', color: 'rgb(100, 67, 68)' },
      { url: '../../../../images/webapi/第一单元/slider02.jpg', title: '开启剑与雪的黑暗传说！', color: 'rgb(43, 35, 26)' },
      { url: '../../../../images/webapi/第一单元/slider03.jpg', title: '真正的jo厨出现了！', color: 'rgb(36, 31, 33)' },
      { url: '../../../../images/webapi/第一单元/slider04.jpg', title: '快来分享你的寒假日常吧~', color: 'rgb(139, 98, 66)' },
      { url: '../../../../images/webapi/第一单元/slider05.jpg', title: '李玉刚：让世界通过B站看到东方大国文化', color: 'rgb(67, 90, 92)' },
      { url: '../../../../images/webapi/第一单元/slider06.jpg', title: '哔哩哔哩小年YEAH', color: 'rgb(166, 131, 143)' },
      { url: '../../../../images/webapi/第一单元/slider07.jpg', title: '一站式解决你的电脑配置问题！！！', color: 'rgb(53, 29, 25)' },
      { url: '../../../../images/webapi/第一单元/slider08.jpg', title: '谁不想和小猫咪贴贴呢！', color: 'rgb(99, 72, 114)' },
    ]

    const random = parseInt(Math.random()*sliderData.length)
    const img = document.querySelector('.slider-wrapper img')
    img.src = sliderData[random].url
  </script>
</body>
</html>